#!/usr/bin/python

from urllib2 import Request,urlopen,URLError,HTTPError

req=Request("http://www.adfdfasdfc.com")
try:
	res=urlopen(req)
except URLError,e:
	if hasattr(e,"code"):
		print "Error code:",e.code
	elif hasattr(e,"reason"):
		print "Error reason:",e.reason
	else:
		print e
else:
	print "all ok"
